package day_05;

import java.util.Scanner;

/**
 * @ClassName Day05Homework_9
 * @Description TODO
 * @Author hp
 * @Date 2021/6/7 16:25
 * @Version 1.0
 **/
public class Day05Homework_9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入本组人数:");
        int num = scanner.nextInt();
        int[] scores = new int[num];

        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第" + (i+1) + "个人的成绩:");
            scores[i] = scanner.nextInt();
        }
        for (int i = 0; i < scores.length - 1; i++) {
            boolean flag = false;
            for (int j = 0; j < scores.length - (i+1); j++) {
                if (scores[j] < scores[j + 1]) {
                    scores[j] = scores[j] ^ scores[j + 1];
                    scores[j + 1] = scores[j] ^ scores[j + 1];
                    scores[j] = scores[j + 1] ^ scores[j];
                    flag = true;
                }
            }
            if (flag = false){
                break;
            }
        }
        for (int i = 0; i <scores.length ; i++) {
            System.out.print(scores[i]+"\t");
        }
    }
}
